package UiLayer;
import java.awt.*;

import javax.swing.border.*;
import javax.swing.*;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

//		The SIZE of the MainFrame will be FIXED at a 16:9 ratio... "as seen on (most) TVs"...
//		
//		The height is 768 pixel
//		The width is 
//		


public class MainFrame extends JFrame {

	private JPanel contentPane;

	// // // // //
	// Launch the application.
	// 
	// All of the text in the main(String[] args) method were generated automatically.
	// // // // //
	
	public static void main(String[] args)
	{
		EventQueue.invokeLater(
		new Runnable()
		{
			public void run()
			{
				try
				{
					MainFrame mainFrame = new MainFrame();
					mainFrame.setVisible(true);
				} 
				catch (Exception e)
				{
					e.printStackTrace();
				}
			}
		}
		);
	}
	
	// Create the MainFrame which will contain the whole visible GUI
	//
	
	public MainFrame() 
	{
		// Name the window.
		//
		super("Vestbjerg Byggecenters Lagerstyring & Kundedatabase");
		
		// Terminates program when closing window
		//
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		// Sets window size.
		//
		setSize(1024, 768);
	
		// Centers the window relative to the screen
		//
		setLocationRelativeTo(null);
		
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		
		setContentPane(contentPane);
				
		// Set comfortable background colour
		// 																		//	MUST be hcanged
		
		// GuiHandler.setBackground(Color.getHSBColor(206, 14, 48));
		
		// Create NORTH primary Panel
		//
		JPanel northPanelPrimary = new JPanel();
		northPanelPrimary.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
		
		contentPane.add(northPanelPrimary, BorderLayout.NORTH);
		
		northPanelPrimary.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
		
//		// Create NORTH secondary Panel
//		//
//		
//		JPanel northPanelSecondary = new JPanel();
//		northPanelSecondary.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
//		
//		contentPane.add(northPanelSecondary, BorderLayout.NORTH);
//		
//		northPanelSecondary.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
		
		// Create NORTH button1
		JButton nBut1 = new JButton("Salg");
		
		nBut1.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				// ... some function
			}
		});
		
		northPanelPrimary.add(nBut1);
		
		// Create button2
		JButton nBut2 = new JButton("Varebeholdning");
		
		nBut2.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				
			}
		});
		
		northPanelPrimary.add(nBut2);
		
		// Create button 3.
		JButton nBut3 = new JButton("Kundekartotek");
		
		nBut3.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				/* What is this now? 
				 * AAh,,, that's the actionListener.. I can use this later U see...
				 * 
				 * Gonna add something I think...
				 * 
				 * */
				
				
				
			}
		});
		
		northPanelPrimary.add(nBut3);
		
		
		// // // 
		// I am not entirely sure we actually need this panel (edit: WEST panel)- it distorts more than the customer benefits from it's possibilities.
		// These possible buttons on the West-panel might aswell be incorporated in the "workFrame" - that is, the Eastern panel.
		// 
		// date20140203 // jeppeGJ // I concur! West Panel is hereby removed FROM the source code and the ENTIRE structure of the GUI is now almost complete.
		// 
		//
// // / // 
//
//		Create west panel...
//
//		
//		JPanel panelWest = new JPanel();
//		
//		panelWest.setBorder(new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null));
//		
//		contentPane.add(panelWest, BorderLayout.WEST);
//		
//		panelWest.setLayout(new BoxLayout(panelWest, BoxLayout.Y_AXIS));

		
		// // //
		// Create east panel.
		//
		
		JPanel panelEast = new JPanel();
		
		contentPane.add(panelEast, BorderLayout.EAST);
		
		panelEast.setLayout(new GridLayout(1, 0, 0, 0));
		
		// Create center panel.
		//
		JPanel panelCenter = new JPanel();
		
		panelCenter.setBorder(new TitledBorder(null, "List of items", TitledBorder.LEADING, TitledBorder.TOP, null, null));
		
		contentPane.add(panelCenter, BorderLayout.CENTER);
		
		panelCenter.setLayout(new BorderLayout(0, 0));
		
		// Create south panel.
		//
		JPanel panelSouth = new JPanel();
		
		panelSouth.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0)));
		
		contentPane.add(panelSouth, BorderLayout.SOUTH);
		
		panelSouth.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
		
		// Create madeBy label.
		//
		JLabel madeBy = new JLabel("UDVIKLER TEAM");
		JLabel developers = new JLabel("/    R.D. Andersen    /    J. Bertelsen    /    T. Franzen    /    J.G. Jensen    /    M.L. Johansen    /");
		panelSouth.add(madeBy);
		
		panelSouth.add(developers);
		
	}
	
//	private class TheHandlerOFTHEMightyPAAAAANESSS()	implements ActionListener
//	{
//		public void actionPerformed(ActionEvent event)
//		{
//			String string = "";
//			
//			if(event.getSource() == item1)
//			{
//				string = String.format("field 1: %s", event.getActionCommand());
//			}
//			else if(event.getSource() == item2)
//			{
//				string = String.format("field 2: %s", event.getActionCommand());
//			}
//			else if(event.getSource() == item3)
//			{
//				string = String.format("field 3: %s", event.getActionCommand());
//			}
//			else if(event.getSource() == passwordField)
//			{
//				string = String.format("password field is : %s", event.getActionCommand());
//			}
//			
//			JOptionPane.showMessageDialog(null, string);
//		}
//	}

}